<?php
/** @var OportunidadController $this */
/** @var Oportunidad $model */
/** @var AweActiveForm $form */
// Prevenir que jquery se cargue dos veces
Util::tsRegisterAssetJs('_form_modal.js');

if ($isModal) {
    Yii::app()->clientScript->scriptMap['jquery.js'] = false;
    Yii::app()->clientScript->scriptMap['jquery.yiigridview.js'] = false;
}
?>
<script>
    var tipoRol = "<?php print $tipoRol; ?>";
</script>

<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-tag"></i> Agregar Usuarios </h4>
</div>
<div class="modal-body">
    <div class="row-fluid">
        <?php
        $this->widget('ext.Truulo.TruuloModuleSearch', array(
            'model' => $model,
//                    'searchParams' => $usersCampania->searchParamsGI(),
            'grid_id' => 'addUserNew-grid',
        ));
        ?>
    </div>
    <!--<div class="addUserNew-grid"></div>-->
    <?php
//    var_dump($UsuariosDP->getdata());
//    die();
    $this->widget('bootstrap.widgets.TbGridView', array(
        'id' => 'addUserNew-grid',
        'afterAjaxUpdate' =>
        "function(id,data){
            updateCheckedRaw();
            loadActionSelect();
            }",
        'type' => 'striped bordered hover advance',
        'dataProvider' => $UsuariosDP,
        'selectableRows' => 2,
        'columns' => array(
            array(
                'name' => '<input type="checkbox"  id="selectall" value="all">',
                'type' => 'raw',
                'value' => '"<input type=\"checkbox\" id=\"ckb_".$data->id."\" class=\"ckeckRow\" value=\"$data->id\">"',
            ),
            array(
                'name' => 'Nombre',
                'value' => '$data->userName',
                'type' => 'raw',
            ),
            array(
                'name' => 'Ultima Session',
                'type' => 'raw',
                'value' => '$data->ultimaSesionUsuario("$data->id")',
            ),
        ),
    ));
    ?>
</div>
<div class="modal-footer">
<?php
$this->widget('bootstrap.widgets.TbButton', array(
    'type' => 'success',
    'icon' => 'ok',
    'label' => Yii::t('AweCrud.app', 'Agregar'),
    'htmlOptions' => array(
        'onClick' => 'js:ajaxAgregar()')
));
?>
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cancel'),
        'htmlOptions' => array(
            'data-dismiss' => 'modal',)
    ));
    ?>
</div>

